﻿using System;
using System.Net;

namespace Abide.Classes
{
    public static class Networking
    {
        public static bool IsConnected()
        {
            try
            {
                using (var client = new WebClient())
                {
                    using (var Stream = client.OpenRead("https://www.dropbox.com/"))
                    {
                        return true;
                    }
                }
            }
            catch (Exception ex)
            {
                //Write
                Console.WriteLine("Failed Internet Connectivity Test");
                Console.WriteLine(ex);
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
                return false;
            }
        }

        public static bool UpdateFileExists()
        {
            try
            {
                using (var client = new WebClient())
                {
                    using (var Stream = client.OpenRead("https://dl.dropboxusercontent.com/u/238557949/Potential%20Software/Abide/Update.xml"))
                    {
                        return true;
                    }
                }
            }
            catch
            {
                return false;
            }
        }
    }
}
